﻿using System.Threading.Tasks;
using Jinjia.Approve.IRepository.JJFlow;
using Jinjia.Approve.IService.JJFlow.Condition;

namespace Jinjia.Approve.Service.JJFlow.Condition
{
    public class BcstRequestCondition : IJJCondition
    {
        private readonly IBcstYearlyDraftPlanRepository _bcstYearlyDraftPlanRepository;

        public BcstRequestCondition(IBcstYearlyDraftPlanRepository bcstYearlyDraftPlanRepository)
        {
            _bcstYearlyDraftPlanRepository = bcstYearlyDraftPlanRepository;
        }

        public async Task<bool> IsSatisfied(string biz_order_id, string depart_id = "0", string user_id="0")
        {
            //根据biz_order_id查找是否存是组员提出的申请;
            var bcstYearlyDraftPlanTbl = await _bcstYearlyDraftPlanRepository.GetByBizOrderId(biz_order_id);
            if (bcstYearlyDraftPlanTbl == null)
                return false;
            return true;
        }
    }
}